package com.sws.worktive.job_advance_search;

import java.util.HashMap;

@SuppressWarnings("unused")
public class JobSearchRequestBody {
	private String zipCode;  
	private String mile;
	private String devapipassword; 
	private String language; 
	private String jobType;
	
	private final String KEY_ZIP_CODE = "zipcode";
	private final String KEY_MILE = "mile";
	private final String KEY_PASSWORD = "devapipassword";
	private final String KEY_LANGUAGE = "language";
	
	
	
	public JobSearchRequestBody(
			String zipCode, 
			String mile,
			String devapipassword,
			String language,
			String jobType){
		
		this.zipCode = zipCode;
		this.mile = mile;
		this.devapipassword = devapipassword;
		this.language = language;
		this.jobType = jobType;
	}
	
	//this is fucking shit, but whatever, i just want to do it fast!!!
	public String toParams(String url){
		StringBuilder stringBuilder = new StringBuilder(url);
		
		stringBuilder.append("?");
		stringBuilder.append(KEY_ZIP_CODE);
		stringBuilder.append("=");
		stringBuilder.append(zipCode);
		
		stringBuilder.append("&");
		stringBuilder.append(KEY_LANGUAGE);
		stringBuilder.append("=");
		stringBuilder.append(language);
		
		stringBuilder.append("&");
		stringBuilder.append(KEY_MILE);
		stringBuilder.append("=");
		stringBuilder.append(mile);
		
		stringBuilder.append("&");
		stringBuilder.append(KEY_PASSWORD);
		stringBuilder.append("=");
		stringBuilder.append(devapipassword);
		
		return stringBuilder.toString();
	}
	
	public HashMap<String, String> toHashMap(){
		HashMap<String, String> map= new HashMap<String, String>();
		map.put(KEY_ZIP_CODE, zipCode);
		map.put(KEY_MILE, mile);
		map.put(KEY_PASSWORD, devapipassword);
		map.put(KEY_LANGUAGE, language);
		return map;
	}
	
}
